package com.jbp.controller;

import com.jbp.model.AppInfo;
import com.jbp.model.Banner;
import com.jbp.service.AppInfoService;
import com.jbp.utils.R;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * 软件管理(AppInfo)表控制层
 * @author cc
 * @since 2020-07-03 22:16:35
 */
@Api(tags ="APP接口--软件信息" ,hidden = true)
@ApiIgnore
@RestController
@RequestMapping("rest/appInfo")
public class AppInfoController {
    @Autowired
    private AppInfoService appInfoService;

    
    @ApiOperation(value="最新版本", hidden = true)
    @GetMapping("/getLatest")
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功",response = AppInfo.class),
            @ApiResponse(code = 201,message = "返回失败信息")
    })
    public R getLatest(){
        List<AppInfo> list = appInfoService.list();
        if (list==null || list.size()==0) {
            return R.ok(null);
        }
        return R.ok(list.get(0));
    }

}